package com.itheima.stringdemo;

public class StringDemo11 {
    public static void main(String[] args) {
        String cardNumber = "342626199103235636";
        System.out.println(cardNumber.length());
        String birthday = cardNumber.substring(6, 14);
        // String sex = cardNumber.substring(16, 17);
        char sex = cardNumber.charAt(16);
        String year = birthday.substring(0, 4);
        String month = birthday.substring(4, 6);
        String day = birthday.substring(6);
        System.out.println("任务信息为：");
        System.out.println("出生年月日：" + year + "年" + month + "月" + day + "日");
        int gender = sex - 48;
        String genderStr= gender % 2 == 0 ? "女" : "男";
        System.out.println("性别为："  + genderStr);
    }
}
